// 循环
using System;
namespace Loop
{
    class LoopList
    {
        static void Main(string[] args)
        {
            // for 
            for (int i = 0; i < 10; i++)
            {
                if (i == 3)
                {
                    break;
                }
                Console.WriteLine("for {0}",i);
            } 
            // foreach
            var fibNumbers = new int[] {0, 1, 1, 2, 3, 5, 8, 13};
            foreach (int element in fibNumbers)
            {
                if (element== 3)
                {
                    break;
                }
                Console.WriteLine($"foreach{element} ");
            }
            // do while
            int don = 0;
            do
            {
                Console.WriteLine(don);
                if (don== 3)
                {
                    break;
                }
                don++;
            } while (don < 5);

            // while
            int whilen = 0;
            while (whilen < 5)
            {
                Console.WriteLine("while"+whilen);
                if (whilen== 3)
                {
                    break;
                }
                whilen++;
            }
        }
    }
}